package in.muton.edushare.pages.publicpages;

import in.muton.edushare.EduShareSession;
import in.muton.edushare.components.images.ProfileImage;
import in.muton.edushare.pages.publicpages.deptpages.DeptPublic;
import in.muton.edushare.panels.images.ImageWithLink;
import in.muton.edushare.url.EduShareURLPanel;
import in.muton.edushare.url.EntityPageParams;
import in.muton.edushare.url.URLLoader;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

import com.edushare.common.constants.ApplicationConstants;
import com.edushare.common.constants.URLConstants;
import com.edushare.common.vo.Departments;

public class DeptWideLink extends Panel {

	public DeptWideLink(String id, IModel<Departments> model) {
		super(id, model);
		add(new EduShareURLPanel("deptLink", model));
		add(new ImageWithLink("deptImg", model, ApplicationConstants.FILE_SUFFIX_THUMB));
		add(new Label("deptDesc", model.getObject().getDeptDesc()).setEscapeModelStrings(false));
		
		PageParameters params = new PageParameters();
		params.put("0", model.getObject().getDeptName());
		params.put("1", model.getObject().getDepartmentId().toString());
		
		Class<? extends WebPage> homePageClass = null;
		if(!EduShareSession.get().isLoggedIn())
			homePageClass = URLLoader.getPageClass(URLConstants.DEPT_PUBLIC_PAGE_HOME);
		else
			homePageClass = URLLoader.getPageClass(URLConstants.DEPARTMENT_PROFILE_PATH);
		
		add(new BookmarkablePageLink<Void>("deptLink2", homePageClass, params));
		add(CSSPackageResource.getHeaderContribution(DeptWideLink.class, "DeptPublicBadgeXL.css"));
	}

	private static final long serialVersionUID = 1838996718118254027L;
}
